﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Microsoft.Win32;
using System.Xml;

namespace Locallab.Ack999Helper.BusinessContextReader
{
    internal class DBHelper
    {
        internal static string GetMgmtDbConnectionString()
        {
            var strServer = string.Empty;
            var strDbName = string.Empty;
            RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\BizTalk Server\3.0\Administration");
            if (key != null)
            {
                strServer = key.GetValue("MgmtDBServer").ToString();
                strDbName = key.GetValue("MgmtDBName").ToString();
            }

            return ("Data Source=" + strServer.Trim() + ";Initial Catalog=" + strDbName.Trim() + ";Integrated Security=True");
        }        
    }
}
